package cn.getech.data.development.function

import java.lang

import cn.getech.data.development.sink.jdbc.config.CustomTableConfig
import com.alibaba.fastjson.JSONObject
import org.apache.flink.api.common.functions.MapFunction
import org.apache.flink.api.java.tuple
import org.apache.flink.types.Row

@deprecated
class HDFSJsonMapFunction(conf: CustomTableConfig) extends MapFunction[tuple.Tuple2[lang.Boolean, Row], String] {
  override def map(t: tuple.Tuple2[lang.Boolean, Row]): String = {
    val nObject = new JSONObject()
    for (i <- 0 until conf.getParamSize) {
      if (!conf.getParams(i).isPartition)
        nObject.put(conf.param_field_names(i), t.f1.getField(i))
    }
    nObject.toString
  }
}
